package de.fhaugsburg.games.boardgames.scrabble.application;

import de.fhaugsburg.games.boardgames.scrabble.IScrabbleEngine;
import de.fhaugsburg.games.boardgames.scrabble.ScrabbleEngine;
import de.fhaugsburg.games.boardgames.scrabble.ScrabbleLetterSack;
import de.fhaugsburg.games.boardgames.scrabble.WordManager;
import de.fhaugsburg.games.boardgames.scrabble.consoleui.BoardView;
import de.fhaugsburg.games.boardgames.scrabble.gui.ScrabbleMainWindow;
import de.fhaugsburg.games.boardgames.scrabble.logging.LoggingHandler;
import de.fhaugsburg.games.boardgames.scrabble.scrabbleboard.ScrabbleBoard;
import de.fhaugsburg.games.boardgames.scrabble.terminal.TerminalServer;

public class ScrabbleLauncherGUI {


	public static void main(String[] args) {
		/**
		 * Native MenuBar/AppName unter MacOSX.
		 */
		System.setProperty("apple.laf.useScreenMenuBar", "true");
        System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Scrabble 2009");

        
		ScrabbleBoard gameBoard = new ScrabbleBoard();
		BoardView gameView = new BoardView(gameBoard);
		
		//initialize engine and surround it by proxy for logging
		//IScrabbleEngine gameEngine = new ScrabbleEngine(gameBoard);
		IScrabbleEngine gameEngine = new ScrabbleEngine(gameBoard, new ScrabbleLetterSack(), new WordManager(gameBoard));
		
		
		
		//create TerminalServer
		TerminalServer terminalServer = new TerminalServer(4);
		
		//commandline interface for the engine
		//CommandProcessor gameProcess =  new CommandProcessor(engineProxy, gameView, terminalServer);

    	//LoggingHandler factory to do all the nasty invocation + logging stuff
		IScrabbleEngine engineProxy = LoggingHandler.scrabbleEngineLogginProxy(gameEngine);
		
		ScrabbleMainWindow mainWindow = new ScrabbleMainWindow(engineProxy);

		
		
/*        javax.swing.SwingUtilities.invokeLater(new Runnable() {
            public void run() {
            }
          });
	*/	

		//register reference to user interface for engine to interact
//		engineProxy.registerGui((IGuiMessage) gameProcess);
		
		//run the game
//		gameProcess.process();
	}
}
